//
//  BMFindPasswordController.m
//  砼车Demo
//
//  Created by apple on 16/1/4.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "BMFindPasswordController.h"

@interface BMFindPasswordController ()
@property (weak, nonatomic) IBOutlet UITextField *phoneTextField;
@property (weak, nonatomic) IBOutlet UITextField *codeTextField;

@end

@implementation BMFindPasswordController

- (IBAction)codeAction:(id)sender {
    
    NSLog(@"获取验证码");
//    NSString *phone = _phoneTextField.text;
//    if (![BMUtils isValidateMobile:phone]) {
//        [self showHint:@"请输入有效手机号码!"];
//        return;
//    }
//    BMRequest *request = [BMRequest requestWithPath:@"obtainVCode.htm"];
//    request.params = @{@"mobile": phone, @"type": @"fp", @"role": kRole};
//    [self showHudWithhint:kDefaultMessage];
//    [[BMHttpTool sharedInstance] postWith:request finish:^(BMResponse *response, NSError *error) {
//        [self hideHud];
//        if (response.status == kResultOK) {
//            __block int timeout = 60; //倒计时时间
//            dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
//            dispatch_source_t _timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0,queue);
//            dispatch_source_set_timer(_timer,dispatch_walltime(NULL, 0),1.0*NSEC_PER_SEC, 0); //每秒执行
//            dispatch_source_set_event_handler(_timer, ^{
//                if(timeout<=0){ //倒计时结束，关闭
//                    dispatch_source_cancel(_timer);
//                    dispatch_async(dispatch_get_main_queue(), ^{
//                        //设置界面的按钮显示 根据自己需求设置
//                        [sender setTitle:@"获取验证码" forState:UIControlStateNormal];
//                        sender.userInteractionEnabled = YES;
//                    });
//                }else{
//                    int seconds = timeout % 60;
//                    NSString *strTime = [NSString stringWithFormat:@"%.2d", seconds];
//                    dispatch_async(dispatch_get_main_queue(), ^{
//                        //设置界面的按钮显示 根据自己需求设置
//                        //NSLog(@"____%@",strTime);
//                        [UIView beginAnimations:nil context:nil];
//                        [UIView setAnimationDuration:1];
//                        [sender setTitle:[NSString stringWithFormat:@"%@秒",strTime] forState:UIControlStateNormal];
//                        [UIView commitAnimations];
//                        sender.userInteractionEnabled = NO;
//                    });
//                    timeout--;
//                }
//            });
//            dispatch_resume(_timer);
//        } else {
//            [self showHint:@"获取验证码失败,请重新获取!"];
//        }
//    }];
}


- (IBAction)nextAction:(id)sender {
    
    NSLog(@"下一步");
    
//    NSString *phone = _phoneTextField.text;
//    if (![BMUtils isValidateMobile:phone]) {
//        [self showHint:@"请输入规范的手机号!"];
//        return;
//    }
//    if (_codeTextField.text.length != 6) {
//        [self showHint:@"请输入6位验证码!"];
//        return;
//    }
//    BMRequest *request = [BMRequest requestWithPath:@"checkVCode.htm"];
//    request.params = @{@"mobile": phone, @"vCode": _codeTextField.text};
//    [self showHudWithhint:kDefaultMessage];
//    [[BMHttpTool sharedInstance] postWith:request finish:^(BMResponse *response, NSError *error) {
//        [self hideHud];
//        if (response.status == kResultOK) {
//            BMResetPasswordController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"resetPasswordVC"];
//            vc.type = 0;
//            vc.mobile = [response.rawResult objectForKey:@"phone"];
//            [self showViewController:vc sender:nil];
//        } else {
//            [self showHint:@"验证码验证失败!"];
//        }
//    }];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
   }

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
   
}

@end
